//
//  MWMineCommonCell.m
//  XiRan-iOS
//
//  Created by Richfit on 2019/10/12.
//  Copyright © 2019 Wood. All rights reserved.
//

#import "MWMineCommonCell.h"

@interface MWMineCommonCell ()

@property(nonatomic, strong) UIImageView *arrowIV;
@property(nonatomic, strong) UIView *separatorView;

@end

@implementation MWMineCommonCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (!(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) {
        return nil;
    }

    [self setupPageSubviews];
    [self layoutPageSubviews];
    
    return self;
}

- (void)setupPageSubviews {
    _iconIV = [[UIImageView alloc] init];
    [self.contentView addSubview:_iconIV];
    
    _titleLB = [[UILabel alloc] init];
    _titleLB.font = MWFont(16);
    _titleLB.textColor = MWHexColor(@"#000000");
    [self.contentView addSubview:_titleLB];
    
    _arrowIV = [[UIImageView alloc] init];
    _arrowIV.image = [UIImage imageNamed:@"ic_arrow_right"];
    [self.contentView addSubview:_arrowIV];
    
    _separatorView = [[UIView alloc] init];
    _separatorView.backgroundColor = MWHexColor(@"#D8D8D8");
    [self.contentView addSubview:_separatorView];
}

- (void)layoutPageSubviews {
    [_iconIV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(18);
        make.centerY.equalTo(self.contentView);
    }];
    
    [_titleLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.iconIV.mas_right).offset(18);
        make.centerY.equalTo(self.contentView);
    }];
    
    [_arrowIV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView).offset(-16);
        make.centerY.equalTo(self.contentView);
    }];
    
    [_separatorView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.equalTo(self.contentView);
        make.height.equalTo(@0.5);
    }];
}

@end
